﻿#建议保存编码为：bom头 + utf8

if ($env:LANG -eq 'zh_CN.UTF-8')
{
	$private:a = @{Expression = { $_.'ip' };Label = 'ip' ;width = 16 },
	#@{Expression = { $_.'端口' };Label = '端口' ;width = 5 },
	@{Expression = { $_.'被控机os类型' };Label = '被控机os类型' ;width = 25 },
	@{Expression = { $_.'被控机显示名' };Label = '被控机显示名' ;width = 25 },
	@{Expression = { $_.'被控机分组名' };Label = '被控机分组名' ;width = 13 }
	#@{Expression = { $_.被控机uuid };width = 15 }
}
else
{
	$private:a = @{Expression = { $_.'ip' };Label = 'ip' ;width = 16 },
	#@{Expression = { $_.'端口' };Label = '端口' ;width = 5 },
	@{Expression = { $_.'被控机os类型' };Label = 'OSTYPE' ;width = 25 },
	@{Expression = { $_.'被控机显示名' };Label = 'NODE NAME' ;width = 25 },
	@{Expression = { $_.'被控机分组名' };Label = 'NODE GROUP' ;width = 13 }
	#@{Expression = { $_.被控机uuid };width = 15 }
}


if ($IsLinux -eq $True)
{
	if ($env:LANG -eq 'zh_CN.UTF-8')
	{
		Write-Host -ForegroundColor green '被控机列表文件存储位置：【/etc/kasini3000/nodelist.csv】'
	}
	else
	{
		Write-Host -ForegroundColor green '【/etc/kasini3000/nodelist.csv】'
	}
}

if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
	if ($env:LANG -eq 'zh_CN.UTF-8')
	{
		Write-Host -ForegroundColor green '被控机列表文件存储位置：【c:\ProgramData\kasini3000\nodelist.csv】'
	}
	else
	{
		Write-Host -ForegroundColor green '【c:\ProgramData\kasini3000\nodelist.csv】'
	}
}

if ($env:LANG -eq 'zh_CN.UTF-8')
{
	Write-Host -ForegroundColor green '====================【所有被控机列表】===================='
}
else
{
	Write-Host -ForegroundColor green '====================【ALL NODE】===================='
}

$global:所有被控机 | Sort-Object -Property ip | Format-Table  $private:a

exit 0
